deserializeFromToml
Deserializes a config class from a TomlElement
Custom deserializer, powered by TomlKt. Deserialization focuses on validation and building a useful error message. Deserialization happens in two ways
EntrySerializer elements are deserialized with their custom
deserializeEntrymethod"Raw" properties and fields are deserialized with the TomlKt by-class-type deserialization.
Configs are deserialized "in place". That is to say, the deserializer iterates over the relevant fields and properties of a pre-instantiated "default" config class. Each relevant field/property is filled in with the results of deserializing from the TomlElement at the matching TomlTable key. If for some reason there is a critical error, the initial config passed in, with whatever deserialization was successfully completed, will be returned as a fallback.
Should be called as a matched pair to serializeToToml. Ex: if ignoreNonSync is false on one end, it needs to be false on the other.
Return
Returns a ValidationResult of ConfigContext and applicable error, containing the config and any flag information
Author
fzzyhmstrs
Since
0.7.0
Parameters
the config type. Can be any Non-Null type.
the config pre-deserialization
the TomlElement to deserialize from. Needs to be a TomlTable
ValidationResult.ErrorEntry.Mutable instance that the deserializer will apply errors to and then use when building it's ValidationResult. Using ValidationResult.createMutable() is a good way to provide a fresh empty mutable error, with an optional header error message.
default IGNORE_NON_SYNC. With the default, elements with the NonSync annotation will be skipped. See the flag options below to serialize the entire config (ex: saving to file), fully syncing (ex: initial sync server -> client), etc.
CHECK_NON_SYNC: Byte = 0
IGNORE_NON_SYNC: Byte = 1
CHECK_RESTART: Byte = 2
IGNORE_NON_SYNC_AND_CHECK_RESTART: Byte = 3
IGNORE_VISIBILITY: Byte = 4
Deserializes a config class from a TomlElement
Custom deserializer, powered by TomlKt. Deserialization focuses on validation and building a useful error message. Deserialization happens in two ways
EntrySerializer elements are deserialized with their custom
deserializeEntrymethod"Raw" properties and fields are deserialized with the TomlKt by-class-type deserialization.
Configs are deserialized "in place". That is to say, the deserializer iterates over the relevant fields and properties of a pre-instantiated "default" config class. Each relevant field/property is filled in with the results of deserializing from the TomlElement at the matching TomlTable key. If for some reason there is a critical error, the initial config passed in, with whatever deserialization was successfully completed, will be returned as a fallback.
Should be called as a matched pair to serializeToToml. Ex: if ignoreNonSync is false on one end, it needs to be false on the other.
Return
Returns a ValidationResult of ConfigContext and applicable error, containing the config and any flag information
Author
fzzyhmstrs
Since
0.7.0
Parameters
the config type. Can be any Non-Null type.
the config pre-deserialization
the TomlElement to deserialize from. Needs to be a TomlTable
String header message that the deserializer will use when building it's ValidationResult.
default IGNORE_NON_SYNC. With the default, elements with the NonSync annotation will be skipped. See the flag options below to serialize the entire config (ex: saving to file), fully syncing (ex: initial sync server -> client), etc.
CHECK_NON_SYNC: Byte = 0
IGNORE_NON_SYNC: Byte = 1
CHECK_RESTART: Byte = 2
IGNORE_NON_SYNC_AND_CHECK_RESTART: Byte = 3
IGNORE_VISIBILITY: Byte = 4
Deprecated
Use overload that takes a ValidationResult.ErrorEntry.Mutable. Scheduled for removal 0.8.0
Deserializes a config class from a TomlElement
Custom deserializer, powered by TomlKt. Deserialization focuses on validation and building a useful error message. Deserialization happens in two ways
EntrySerializer elements are deserialized with their custom
deserializeEntrymethod"Raw" properties and fields are deserialized with the TomlKt by-class-type deserialization.
Configs are deserialized "in place". That is to say, the deserializer iterates over the relevant fields and properties of a pre-instantiated "default" config class. Each relevant field/property is filled in with the results of deserializing from the TomlElement at the matching TomlTable key. If for some reason there is a critical error, the initial config passed in, with whatever deserialization was successfully completed, will be returned as a fallback.
Should be called as a matched pair to serializeToToml. Ex: if ignoreNonSync is false on one end, it needs to be false on the other.
Return
Returns a ValidationResult of ConfigContext and applicable error, containing the config and any flag information
Author
fzzyhmstrs
Since
0.2.0, deprecated 0.7.0 and scheduled for removal 0.8.0
Parameters
the config type. Can be any Non-Null type.
the config pre-deserialization
the TomlElement to deserialize from. Needs to be a TomlTable
a mutableList of strings the original caller of deserialization can use to print a detailed error log
default IGNORE_NON_SYNC. With the default, elements with the NonSync annotation will be skipped. See the flag options below to serialize the entire config (ex: saving to file), fully syncing (ex: initial sync server -> client), etc.
CHECK_NON_SYNC: Byte = 0
IGNORE_NON_SYNC: Byte = 1
CHECK_RESTART: Byte = 2
IGNORE_NON_SYNC_AND_CHECK_RESTART: Byte = 3
IGNORE_VISIBILITY: Byte = 4